package cn.iocoder.yudao.module.digital.service.cardkeyorder;

import cn.iocoder.yudao.module.digital.dal.dataobject.cardkeyorder.CardkeyOrderCardSecretDO;
import cn.iocoder.yudao.module.digital.dal.dataobject.cardkeyorder.CardkeyOrderDO;
import cn.iocoder.yudao.module.digital.enums.cardkeysecret.CardKeySourceEnum;
import cn.iocoder.yudao.module.digital.service.cardchannel.model.common.CdkGenCardReq;
import cn.iocoder.yudao.module.digital.service.cardchannel.model.common.CdkOrderStatusEnum;

import java.time.Duration;
import java.util.Collection;
import java.util.List;

/**
 * 卡密订单 Service 接口
 *
 * @author 超管
 */
public interface CardkeyOrderService {

    CardkeyOrderDO getCardKeyOrder(String id);

    CardkeyOrderDO getCardKeyOrderNoCheck(String id);

    CardkeyOrderDO getCardKeyOrderByChannelCardOrderId(CardKeySourceEnum source, String channelCardOrderId);

    String createCardKeyOrder(CardKeySourceEnum source, String cardOrderId, List<CdkGenCardReq.Product> products);

    void updateCardKeyOrder(String cardOrderId, String channelOrderId, String channelInnerOrderId,
                            CdkOrderStatusEnum orderStatus, String errorMsg,
                            List<CardkeyOrderCardSecretDO> cards);

    void updateCardKeyOrderFailOrException(String cardOrderId, String channelOrderId, String channelInnerOrderId,
                                           CdkOrderStatusEnum orderStatus, String errorMsg);

    List<CardkeyOrderDO> getTimeoutCardKeyOrder(Duration timeoutDuration);

}